﻿using System;
using SharpKit.JavaScript;

namespace SharpKit.SetOnX
{
    /// <summary>
    /// Base class for all SetOnX Messages
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    public class SetOnXMessage
    {
        /// <summary>
        /// Message type
        /// </summary>
        [JsProperty(Name = "message", NativeField = true)]
        public SetOnXMessageType Message { get; set; }

        #region Audio message attributes
        /// <summary>
        /// "0" - "100"    // when specifying a stream
        /// "silent", "vibrate","normal"    // when only specifying volume
        /// </summary>
        [JsProperty(Name = "volume")]
        public string Volume { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [JsProperty(Name = "vibrate")]
        public BooleanEnum Vibrate { get; set; }

        /// <summary>
        /// "ring", "notification", "music"
        /// </summary>
        [JsProperty(Name = "stream")]
        public AudioStream Stream { get; set; }
        #endregion

        #region Radio message attributes
        /// <summary>
        /// 
        /// </summary>
        [JsProperty(Name = "wifiState", NativeField = true)]
        public EnableDisable WifiState { get; set; }

        /// <summary>
        /// 
        /// 
        /// </summary>
        [JsProperty(Name = "blueToothState", NativeField = true)]
        public EnableDisable BlueToothState { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [JsProperty(Name = "airplaneMode", NativeField = true)]
        public EnableDisableToggle AirplaneMode { get; set; }
        #endregion

        #region Screen message attributes
        /// <summary>
        /// 
        /// </summary>
        [JsProperty(Name = "on", NativeField = true)]
        public BooleanEnum On { get; set; }
        #endregion

        #region Toast attributes
        /// <summary>
        /// 
        /// </summary>
        [JsProperty(Name = "text", NativeField = true)]
        public string Text { get; set; }
        #endregion
    }
    /// <summary>
    /// Message type
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    [JsEnum(ValuesAsNames = true)]
    public enum SetOnXMessageType
    {
        /// <summary>
        /// Audio Messages
        /// </summary>
        [JsField(Name = "audio")]
        Audio,

        /// <summary>
        /// Radio Messages
        /// </summary>
        [JsField(Name = "network")]
        Network,

        /// <summary>
        /// Radio Messages
        /// </summary>
        [JsField(Name = "screen")]
        Screen,

        /// <summary>
        /// Toast Messages
        /// </summary>
        [JsField(Name = "toast")]
        Toast
    }

    /// <summary>
    /// Boolean enum
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    [JsEnum(ValuesAsNames = true)]
    public enum BooleanEnum
    {
        /// <summary>
        /// Audio Messages
        /// </summary>
        [JsField(Name = "true")]
        True,

        /// <summary>
        /// Radio Messages
        /// </summary>
        [JsField(Name = "false")]
        False
    }

    /// <summary>
    /// Audio Stream
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    [JsEnum(ValuesAsNames = true)]
    public enum AudioStream
    {
        /// <summary>
        /// 
        /// </summary>
        [JsField(Name = "ring")]
        Ring,

        /// <summary>
        /// 
        /// </summary>
        [JsField(Name = "notification")]
        Notification,

        /// <summary>
        /// 
        /// </summary>
        [JsField(Name = "music")]
        Music
    }

    /// <summary>
    /// Enable/Disable enum
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    [JsEnum(ValuesAsNames = true)]
    public enum EnableDisable
    {
        /// <summary>
        /// Enable
        /// </summary>
        [JsField(Name = "enable")]
        Enable,

        /// <summary>
        /// Disable
        /// </summary>
        [JsField(Name = "disable")]
        Disable
    }

    /// <summary>
    /// Enable/Disable/Toggle enum
    /// </summary>
    [JsType(JsMode.Json, Export = false)]
    [JsEnum(ValuesAsNames = true)]
    public enum EnableDisableToggle
    {
        /// <summary>
        /// Enable
        /// </summary>
        [JsField(Name = "enable")]
        Enable,

        /// <summary>
        /// Disable
        /// </summary>
        [JsField(Name = "disable")]
        Disable,

        /// <summary>
        /// Toggle
        /// </summary>
        [JsField(Name = "toggle")]
        Toggle
    }
}
